package utils

import "strings"

func SubAfter(s string, separator string, isLastSeparator bool) string {

	if len(s) == 0 {
		return ""
	} else if separator == "" {
		return ""
	} else {

		var pos int

		if isLastSeparator {
			pos = strings.LastIndex(s, separator)
		} else {
			pos = strings.Index(s, separator)
		}

		if pos != -1 && len(s)-1 != pos {
			return s[pos+len(separator):]
		} else {
			return ""
		}
	}
}
